const querystring = require('querystring')

const qs = 'x=3&y=4'
const parsed = querystring.parse(qs)
console.log(parsed)//{ x: '3', y: '4' }

const obj = { x: '3', y: '4' }

const parsed1 = querystring.stringify(obj)
console.log(parsed1)//x=3&y=4

const str = 'id=3&city=北京&url=www.baidu.com'
// 编码
console.log(querystring.escape(str))//id%3D3%26city%3D%E5%8C%97%E4%BA%AC%26url%3Dwww.baidu.com
const str1 = 'id%3D3%26city%3D%E5%8C%97%E4%BA%AC%26url%3Dwww.baidu.com'
//解码
console.log(querystring.unescape(str1))